//
// Created by zhou on 2021/11/7.
//
#include "iostream"
#include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
    double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) {
        int size1=nums1.size();
        int size2=nums2.size();
        double result=0;
        for(int i=0;i<size2;i++){
            nums1.push_back(nums2[i]);
        }
        sort(nums1.begin(),nums1.end());
        if((size1+size2)%2==1){
            result=nums1[(size1+size2)/2];
            return result;
        }
        else{
            result=(nums1[(size1+size2)/2-1]+nums1[(size1+size2)/2]);
            result=result/2;
            return result;

        }
    }
};
int main(){
    vector<int>nums1={1,2};
    vector<int>nums2={3,4};
    Solution solution;
    cout<<solution.findMedianSortedArrays(nums1,nums2);
}